#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>

using namespace std;

//两组互斥锁
//两组条件变量


//定义共享资源

typedef struct{
    int value;
    pthread_mutex_t rc;
    pthread_cond_t  rm;    
    int r_wait;
    pthread_mutex_t  wc;
    pthread_mutex_t  wm;
}Storage;

void set_data(Storage*s,int value){
    s->value=value;
}

int get_data(Storage*s){
    return s->value;
}


//计算并讲结果放置到线程运行函数
void* set_fn(void*arg){

    

    return (void*)0;
}


void* get_fn(void*arg){


    
    return (void*)0;

}


#if 0


int main(){
    int err;
    pthread_t rth,wth;

    Storage s;
    s.r_wait=0;
    
    pthread_cond_init(&s.rc,NULL);
    pthread_cond_init(&s.wc,NULL);
    pthread_mutex_init(&s.rm,NULL);
    pthread_mutex_init(&s.wm,NULL);


    if((err=pthread_create(&rth,NULL,set_fn,(void*)&s))<0){
        perror("pthread_create");
        exit(1);
    }

    if((err=pthread_create(&wth,NULL,get_fn,(void*)&s))<0){
        perror("pthread_create");
        exit(1);
    }






    pthread_join(rth,NULL);
    pthread_join(wth,NULL);

    pthread_cond_destroy(&s.rc);
    pthread_cond_destroy(&s.wc);

    pthread_mutex_destroy(&s.rm);
    pthread_mutex_destroy(&s.wm);




}

#endif